#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int mySqrt(int x) {
    int left = 0;int right = 70000;
    while (left < right)
    {
        int mid = left + (right - left) / 2;
        if ((long)mid * (long)mid > x)right = mid - 1;
        else if ((long)mid * (long)mid < x)left = mid;
        else return mid;
        
    }
    return left;
}
int main()
{
    mySqrt(4);
    return 0;
}